<?php
/**
 * Created by PhpStorm.
 * User: trisatria
 * Date: 1/6/14
 * Time: 12:51 PM
 */

return array(
    'controllers' => array(
        'invokables' => array(
            'Api\Controller\Index' => 'Api\Controller\IndexController',
            'Api\Controller\Topic' => 'Api\Controller\TopicController',
            'Api\Controller\User' => 'Api\Controller\UserController',
            'Api\Controller\Commend' => 'Api\Controller\CommendController',
            'Api\Controller\Categories' => 'Api\Controller\CategoriesController',
            'Api\Controller\Product' => 'Api\Controller\ProductController',
            'Api\Controller\Login' => 'Api\Controller\LoginController',
            'Api\Controller\Logout' => 'Api\Controller\LogoutController',
            'Api\Controller\Register' => 'Api\Controller\RegisterController',
            'Api\Controller\Appversion' => 'Api\Controller\AppversionController',
        ),
    ),
    'router' => array(
        'routes' => array(
            'api' => array(
                'type'    => 'Literal',
                'priority'=> 3,
                'options' => array(
                    'route'    => '/api',
                    'defaults' => array(
                        '__NAMESPACE__' => 'Api\Controller',
                        'controller'    => 'Topic',
                        'action'        => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'child' => array(
                        'type'    => 'Segment',
                        'options' => array(
                            'route'    => '[/:controller[/:action]][/:id][/topic/:topic_id]',
                            'constraints' => array(
                                'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'id'     => '[0-9]+',
                                'topic_id' => '[0-9]+',
                            ),
                            'defaults' => array(
                            ),
                        ),
                    ),
                ),
                'user' => array(
                    'type'    => 'segment',
                    'options' => array(
                        'route'    => '/user[/:action][/:param]',
                        'constraints' => array(
                            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'param'     => '[0-9]+',
                        ),
                        'defaults' => array(
                            '__NAMESPACE__' => 'Api\Controller',
                            'controller' => 'User',
                            'action'     => 'index',
                        ),
                    ),
                ),
                'register' => array(
                    'type'    => 'segment',
                    'options' => array(
                        'route'    => '/register[/:action][/:param]',
                        'constraints' => array(
                            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'param'     => '[0-9]+',
                        ),
                        'defaults' => array(
                            '__NAMESPACE__' => 'Api\Controller',
                            'controller' => 'Register',
                            'action'     => 'index',
                        ),
                    ),
                ),
                'appversion' => array(
                    'type'    => 'segment',
                    'options' => array(
                        'route'    => '/appversion[/:action][/:param]',
                        'constraints' => array(
                            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'param'     => '[0-9]+',
                        ),
                        'defaults' => array(
                            '__NAMESPACE__' => 'Api\Controller',
                            'controller' => 'Appversion',
                            'action'     => 'index',
                        ),
                    ),
                ),
            ),
        ),
    ),

    'view_manager' => array(
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
        'doctype'                  => 'HTML5',
        'not_found_template'       => 'error/404',
        'exception_template'       => 'error/index',
        'template_path_stack' => array(
            'api' => __DIR__ . '/../view',
        ),
        'template_map' => array(
            'api/layout'   => __DIR__ . '/../../../public/templates/front/layout.phtml',
            'error/404'               => __DIR__ . '/../view/error/404.phtml',
            'error/index'             => __DIR__ . '/../view/error/index.phtml',
        )
    ),

);